From: Tim Starling Date: Wed, 25 Apr 2007 07:41:00 +0000 (+0000) Subject: username in SQL comments X-Git-Tag: 1.31.0-rc.0~53239 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=0dd9f810786e382c1cf9f4a65d76980f7488e295;p=lhc%2Fweb%2Fwiklou.git username in SQL comments --- diff --git a/includes/Database.php b/includes/Database.php index 4dab26ca1c..ef18a6de2a 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -707,11 +707,21 @@ class Database { $this->mLastQuery = $sql; # Add a comment for easy SHOW PROCESSLIST interpretation - if ( $fname ) { - $commentedSql = preg_replace('/\s/', " /* $fname */ ", $sql, 1); - } else { - $commentedSql = $sql; - } + #if ( $fname ) { + global $wgUser; + if ( is_object( $wgUser ) ) { + $userName = $wgUser->getName(); + if ( strlen( $userName ) > 15 ) { + $userName = substr( $userName, 0, 15 ) . '...'; + } + $userName = str_replace( '/', '', $userName ); + } else { + $userName = ''; + } + $commentedSql = preg_replace('/\s/', " /* $fname $userName */ ", $sql, 1); + #} else { + # $commentedSql = $sql; + #} # If DBO_TRX is set, start a transaction if ( ( $this->mFlags & DBO_TRX ) && !$this->trxLevel() &&